package apiday03sdex;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
//创建一个
public class GenericDemo {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");

        Iterator<String> it = c.iterator();
        while (it.hasNext()) {
            String str = it.next();
            System.out.println(str);
        }

        for (String str : c) {
            System.out.println(str);
        }


    }
}
